<?php

use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\Auth\RegisterController;
use App\Http\Controllers\GoodsController;
use App\Http\Controllers\UserController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group(['middleware' => 'auth:sanctum'], function () {
    Route::get('/user', [UserController::class, 'user']);
    Route::post('/alipay', [UserController::class, 'updateAlipay']);
    Route::post('/password', [UserController::class, 'updatePassword']);
    Route::post("/withdraw", [UserController::class, 'withdraw']);
    Route::get("/withdraw-log", [UserController::class, 'withdrawLog']);
    Route::post('/goods',[GoodsController::class,'create']);
    Route::delete('/goods/{goods}', [GoodsController::class, 'delete']);
    Route::get('/goods/my', [GoodsController::class, 'my']);
    Route::get('/orders/wait-send',[\App\Http\Controllers\OrderController::class,'waitSend']);
    Route::resource('/orders', OrderController::class);
    Route::post('/orders/{order}/confirm',[\App\Http\Controllers\OrderController::class,'confirmReceive']);
    Route::post('/orders/{order}/send',[\App\Http\Controllers\OrderController::class,'send']);
    Route::post('/images',[GoodsController::class,'saveImage']);
    Route::get('/messages',[\App\Http\Controllers\MessageController::class,'index']);
    Route::post('/messages/{message}/read', [\App\Http\Controllers\MessageController::class, 'read']);
    Route::get('/complains', [\App\Http\Controllers\ComplainController::class,'index']);
    Route::get('/complains/{complain}', [\App\Http\Controllers\ComplainController::class,'show']);
    Route::post('/complains',[\App\Http\Controllers\ComplainController::class,'store']);
});
Route::get('goods/{goods}',[GoodsController::class,'show']);
Route::get('/goods', [GoodsController::class,'index']);
Route::resource("/articles", ArticleController::class);
Route::post('/login',[LoginController::class,'login']);
Route::post('/register', [RegisterController::class,'register']);
